package com.core.zyyz.pcmc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.core.zyyz.pcmc.domain.PcmcTask;
import com.core.zyyz.pcmc.service.PcmcTaskService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.core.common.annotation.Log;
import com.core.common.core.controller.BaseController;
import com.core.common.core.domain.AjaxResult;
import com.core.common.enums.BusinessType;
import com.core.common.utils.poi.ExcelUtil;
import com.core.common.core.page.TableDataInfo;

/**
 * 任务Controller
 *
 * @author core
 * @date 2024-10-24
 */
@RestController
@RequestMapping("/pcmc/task")
public class PcmcTaskController extends BaseController
{
    @Autowired
    private PcmcTaskService pcmcTaskService;

    /**
     * 查询任务列表
     */
    @PreAuthorize("@ss.hasPermi('pcmc:task:list')")
    @GetMapping("/list")
    public TableDataInfo list(PcmcTask pcmcTask)
    {
        startPage();
        List<PcmcTask> list = pcmcTaskService.selectPcmcTaskList(pcmcTask);
        return getDataTable(list);
    }

    /**
     * 获取任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('pcmc:task:query')")
    @GetMapping(value = "/{taskId}")
    public AjaxResult getInfo(@PathVariable("taskId") Long taskId)
    {
        return success(pcmcTaskService.selectPcmcTaskByTaskId(taskId));
    }

    /**
     * 删除任务
     */
    @PreAuthorize("@ss.hasPermi('pcmc:task:remove')")
    @Log(title = "任务", businessType = BusinessType.DELETE)
    @DeleteMapping("/{taskIds}")
    public AjaxResult remove(@PathVariable Long[] taskIds)
    {
        return toAjax(pcmcTaskService.deletePcmcTaskByTaskIds(taskIds));
    }
}
